load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "clisqlshell",
    srcs = [
        "api.go",
        "complete.go",
        "context.go",
        "describe.go",
        "doc.go",
        "editor.go",
        "editor_bimodal.go",
        "editor_bubbline.go",
        "editor_bufio.go",
        "parser.go",
        "scan_local_cmd.go",
        "sql.go",
        "statement_diag.go",
        "statements_value.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/cli/clisqlshell",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/cli/clicfg",
        "//pkg/cli/clierror",
        "//pkg/cli/clisqlclient",
        "//pkg/cli/clisqlexec",
        "//pkg/cli/democluster/api",
        "//pkg/docs",
        "//pkg/security/password",
        "//pkg/security/pprompt",
        "//pkg/server/pgurl",
        "//pkg/sql/lexbase",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/scanner",
        "//pkg/sql/sqlfsm",
        "//pkg/util/envutil",
        "//pkg/util/syncutil",
        "//pkg/util/sysutil",
        "@com_github_charmbracelet_bubbles//cursor",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_errors//oserror",
        "@com_github_knz_bubbline//:bubbline",
        "@com_github_knz_bubbline//computil",
        "@com_github_knz_bubbline//editline",
        "@com_github_knz_bubbline//history",
    ],
)

go_test(
    name = "clisqlshell_test",
    srcs = [
        "complete_test.go",
        "describe_test.go",
        "editor_bubbline_test.go",
        "main_test.go",
        "scan_local_cmd_test.go",
        "sql_internal_test.go",
        "sql_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":clisqlshell"],
    deps = [
        "//pkg/base",
        "//pkg/build",
        "//pkg/cli",
        "//pkg/cli/clicfg",
        "//pkg/cli/clierror",
        "//pkg/cli/clisqlclient",
        "//pkg/cli/clisqlexec",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/sql/lexbase",
        "//pkg/sql/scanner",
        "//pkg/testutils/serverutils",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_knz_bubbline//computil",
        "@com_github_stretchr_testify//assert",
    ],
)
